# script used to map fields in the demo search form.

# Note: This is a very primitive schema system which will suffice for the demo search forms at this stage.
# Once we he have determined the full functionality required for this, we should re-implement as a proper
# schema system and implement as a core feature of KE.

# widgets are MultiSelect, DropDown, TextBox, Range or Hidden
# set join=True on multiselectable items or to avoid the search table ( Will search KE latestAnswers table rather than searchIndex table )
# search types for text and numeric boxes are like, equals, startswith and fulltext (searchType='TYPE')
# the range widget can accept valueType= either Integer (for numbers) or String (this is default so do not specify)
# the hidden widget accepts a value as default= and the label should be set to blank, dict like this
# dict(idx='KE4Search_mcq',                       label='', default='Answer B', widget='Hidden'),
# Model EChooser idx='SI IDX of Primary EChooser' link=('ModelSearchRelation of donor model', 'SI IDX of doner component')
# MySQL EChooser search sqlLink=('dbtable', 'field name', "id")
# MySQL EChooser the db if same just state the table name ex: workflow, if in another DB state dbname.tablename

# SPECIFY MODEL ID - to limit a particular criteria to only bring back results on a particular model 
# stick into the dict statement: modelIdentities=['modelid','modelid']
# LIMIT VOCAB TO PARTICULAR COMPONENT - because SI's can be used accross multiple components in dif use cases
# you can limit the vocab of a criteria in form. 1st Define the component
# testEntityChooser = context.getComponentByIdentity('ec01168491383356960706677') (above the return statement)
# then define the vocab in the dict statement: vocab=testEntityChooser.getVocab()

# demo model here: http://entitykepl25.faulknertechnologies.com/models/model.DemoSearchTesting/section1/folder_contents

#testEntityChooserVocab = context.getComponentByIdentity('ec01166836990494006906737')
#testListQuestionVocab = context.getComponentByIdentity('lookup01151911832646753291013')
#testLinkQuestionVocab = context.getComponentByIdentity('link01151911582889966127767')

return [
    #dict(idx='createdBy',                           label='Created By', widget='TextBox', searchType='like', isMetadata=True),
    dict(idx='instantCreated',                      label='Instant Created', widget='DateRange', isMetadata=True),
    #dict(idx='instantModified',                     label='Instant Modified', widget='Range', isMetadata=True),
    #dict(idx='KE4Search_choice',                    label='KE4Search_choice'), 
    #dict(idx='KE4Search_date',                      label='KE4Search_Date Range Test',  widget='DateRange'),
    #dict(idx='KE4Search_list',                      label='KE4Search_list Users', searchType='equals', widget='MultiSelect'),
    #dict(idx='KE4Search_list',                      label='KE4Search_list Users - defined vocab', searchType='equals', widget='MultiSelect'),
    #dict(idx='KE4Search_list_basic',                label='KE4Search_list_basic'),
    #dict(idx='KE4Search_LinkPrimary',               label='Link Search testing: KE4Search_LinkPrimary', link=('linkModel', 'KE4Search_LinkSecondary'), widget='MultiSelect'),
    #dict(idx='KE4Search_LinkPrimary',               label='Link Search testing: KE4Search_LinkPrimary - defined vocab', link=('linkModel', 'KE4Search_LinkSecondary'), widget='MultiSelect'),
    #dict(idx='KE4Search_mcq',                       label='KE4Search_mcq'),
    #dict(idx='KE4Search_numericbox',                label='KE4Search_numericbox<br /><i>a bit silly really except for exact matches</i><br />', widget='TextBox', searchType='equals'),
    #dict(idx='KE4Search_numrange',                  label='KE4Search_Num Range Test',   widget='Range', valueType='Integer'),
    #dict(idx='KE4Search_textboxSL',                 label='KE4Search_textboxSL<br /><i>equals for a textbox is a tough search</i>', widget='TextBox', searchType='fulltext'),
    #dict(idx='KE4Search_textboxML',                 label='KE4Search_textboxML', widget='TextBox', searchType='like'),
    #dict(idx='KE4Search_selectionRadio',            label='KE4Search_selectionRadio'),
    #dict(idx='KE4Search_selectionDrdwn',            label='KE4Search_selectionDrdwn'),
    #dict(idx='KE4Search_selectionCkBox',            label='KE4Search_selectionCkBox', widget='MultiSelect', join=True),
    #dict(idx='KE4Search_selectionMultiSel',         label='KE4Search_selectionMultiSel', widget='MultiSelect', join=True),
    #dict(idx='KE4Search_RelationshipPrimary',       label='EChooser Testing: KE4Search_RelationshipPrimary searching KE4Search_RelationshipSecondary', link=('entityModelONE', 'KE4Search_RelationshipSecondary'), widget='TextBox', searchType='like', join=True),
    #dict(idx='KE4Search_RelationshipPrimaryMySQL',  label="EChooser Testing: KE4Search_RelationshipPrimaryMySQL", sqlLink=('workflow', 'comments', "id"), widget='TextBox', searchType='like', join=True),
    #dict(idx='KE4Search_RelationshipPrimary',       label='EChooser Testing: KE4Search_RelationshipPrimary', widget='MultiSelect', join=True),
    #dict(idx='KE4Search_RelationshipPrimary',       label='EChooser Testing: KE4Search_RelationshipPrimary - defined vocab', widget='MultiSelect')
]
    
        

